var prmoseHttp = require('../../utils/prmoseHttp.js');
Page({
  data: {
    statusBarHeight: '',
    titleBarHeight: '',
    navHeight: '',
    inVita:{},
    active:true,
    signOpened:false,
    isLink:false,
    noCont:false
  },
  onLoad() {
     my.getSystemInfo({
      success: (res) => {
        this.setData({
          'statusBarHeight': res.statusBarHeight,//状态栏高度 
          'titleBarHeight': res.titleBarHeight,//标题栏高度
          'navHeight': res.statusBarHeight + res.titleBarHeight //导航栏高度
         
        })
      }
    })
    if(my.getStorageSync({key:'userInfo'}).data.id){
      let id = my.getStorageSync({key:'userInfo'}).data.id;
      this.setData({
        userId:id,
      })
    }
    this.getReward();
  },
  getReward(){
    let that = this;
    prmoseHttp.publicRequest(prmoseHttp.apiAddress.invitaReward,{},1,'get').then(res=>{
      // console.log(res)
      that.setData({
        inVita:res.data
      })
      // my.stopPullDownRefresh();
    })
  },
  selTab(e){
    let num = e.currentTarget.dataset.num;
    if(num == '1'){
      this.setData({
        active : true
      })
    }else{
      this.setData({
        active : false
      })
    }
  },
  rules(){
    this.setData({
      signOpened:true,
    })
  },
  onSignClose(){
    this.setData({
      signOpened:false,
    })
  },
  share(){
    my.showSharePanel();
  },
  onShareAppMessage () {
    return {
      title: '挣点', // 标题
      desc: '任务多多，天天领取现金红包', // 描述
      path: 'pages/index/index?userid='+this.data.userId, // 分享的小程序页面
      success(res){
        this.closeJoin();
        my.navigateTo({
          url: '/pages/shareSuccess/shareSuccess'
        }); 
      },
      fail(res){
        console.log('fail',res)
      },
    }
  },
});
